package gao.xiaolei.dao;

import gao.xiaolei.entity.UserClass;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("UserClassesDao")
public interface UserClassesDao extends JpaRepository<UserClass,String> {

    @Query("select userId from UserClass where classId=:classId")
    public List<String> getUserIdsByClassId(@Param("classId") String classId);

    @Query("select classId from UserClass where userId=:userId")
    public List<String> getClassIdsByUserId(@Param("userId") String userId);

    public void deleteAllByClassId(String classesId);

    public Integer countAllByUserId(String userId);

    public Integer countAllByClassId(String classesId);
}
